<link href="/static/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
<section style="overflow-y: scroll;margin-bottom:20px;" class="Hui-article-box">
    <div class="panel panel-default">
	<div class="panel-header">小程序信息</div>
        <div class="panel-body">
            <form method="post" class="form form-horizontal" id="form">
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">AppID：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" name="appid"  placeholder="小程序AppID" value="<?=config('appid')?>" class="input-text">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">AppSecret：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" name="appsecret"  placeholder="小程序AppSecret" value="<?=config('appsecret')?>" class="input-text">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">支付商户号：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" name="pay_mchid"  placeholder="小程序支付商户号" value="<?=config('pay_mchid')?>" class="input-text">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">支付密钥：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" name="pay_key"  placeholder="小程序支付密钥" value="<?=config('pay_key')?>" class="input-text">
                    </div>
                </div>
                <div class="row cl">
                    <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                        <a onclick="AjaxFormSubmit()" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe632;</i> 保存</a>
                    </div>
                </div>
            </form>
        </div>
    </div>
</section>
<script type="text/javascript" src="/static/lib/jquery/1.9.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/plupload/3.1.0/plupload.js"></script>
<script type="text/javascript">
MXI_DEBUG = false;
var ids = new Array("upload");
$.each(ids,function(i,n){
    var self = this.toString();
    var uploader = new plupload.Uploader({
        browse_button: self, // this can be an id of a DOM element or the DOM element itself
        url: '/admin/config/uploadpic',
        multi_selection: false,
        filters: {
            mime_types : [
                { title : "Image files", extensions : "jpg,gif,png,jpeg" }
            ]
        },
        init: {
            FilesAdded: function (e) {
                layer.load();//正在加载
                uploader.start();
            },
            FileUploaded: function (up, file, info) {
                layer.closeAll('loading');//关闭正在加载
                var res = JSON.parse(info.response);
                if(res.ret==0) {
                    var img = "<img src='"+res.data+"'/>";
                    $('#'+self+'-list').html(img);
                    $('#'+self+'-input').val(res.data);
                }
            }
        }
    });
uploader.init();
});

</script>
